import type { App } from "vue";
import { useUserInfoStore } from "@/stores/userInfo";

const UserInfoState = useUserInfoStore();
const registerPermissionDirective = (app: App) => {
  app.directive("permission", (el, binding) => {
    if (!UserInfoState.buttons.includes(binding.value)) {
      el.remove();
    }
  });
};

export default registerPermissionDirective;
